<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh">
 <head>
  <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
  <meta content="2018-10-23T06:18:10.521000000" name="created"/>
  <meta content="2023-12-12T09:31:25" name="changed" translator="gocpicnic"/>
  <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
  <meta content="zh" http-equiv="Content-Language"/>
  <title>
   <!-- Random -->
   随机生成器
  </title>
  <link href="../../style.css" rel="stylesheet" type="text/css"/>
 </head>
 <body>
  <div class="maindiv">
   <h1>
    <!-- <img class="iconlibs" src="../../../../icons/6464/random.png" alt="#########" width="32" height="32"> <em>Random</em> -->
    <img alt="#########" class="iconlibs" height="32" src="../../../../icons/6464/random.png" width="32"/>
    <em>
     随机生成器
    </em>
   </h1>
   <table>
    <tbody>
     <tr>
      <td>
       <!-- <strong>Library:</strong> -->
       <strong>
        库:
       </strong>
      </td>
      <td>
       <!-- <a href="index.html">Memory</a> -->
       <a href="index.html">
        存储
       </a>
      </td>
     </tr>
     <tr>
      <td>
       <!-- <strong>Introduced:</strong> -->
       <strong>
        介绍:
       </strong>
      </td>
      <td>
       2.3.0
      </td>
     </tr>
     <tr>
      <td valign="top">
       <!-- <strong>Appearance:</strong> -->
       <strong>
        外观符号:
       </strong>
      </td>
      <td valign="top">
       <img alt="#########" class="appearancelibs" height="64" src="../../../../img-libs/random.png" width="64"/>
      </td>
     </tr>
    </tbody>
   </table>
   <h2>
    <!-- Behavior -->
    行为
   </h2>
   <p>
    <!-- This component iterates through a pseudorandom sequence of numbers, which steps forward to the following number in the sequence each time the clock is triggered while the component is enabled. Technically speaking, the algorithm used to compute the pseudorandom sequence is a linear congruential generator: Starting from a seed <var>r</var><sub><small>0</small></sub>, the following number <var>r</var><sub><small>1</small></sub> is the number -->
    该组件迭代伪随机数字序列，每次在组件启用时触发时钟时，该序列都会前进到序列中的下一个数字。 从技术上讲，用于计算伪随机序列的算法是线性同余生成器：从种子
    <var>
     r
    </var>
    <sub>
     <small>
      0
     </small>
    </sub>
    开始，以下数字
    <var>
     r
    </var>
    <sub>
     <small>
      0
     </small>
    </sub>
    &gt;r
    <sub>
     <small>
      1
     </small>
    </sub>
    是数字
   </p>
   <center>
    <!-- <var>r</var><sub><small>1</small></sub> = (25,214,903,917 <var>r</var><sub><small>0</small></sub> + 11) mod 2<sup><small>48</small></sup> -->
    <var>
     r
    </var>
    <sub>
     <small>
      1
     </small>
    </sub>
    = (25,214,903,917
    <var>
     r
    </var>
    <sub>
     <small>
      0
     </small>
    </sub>
    + 11) mod 2
    <sup>
     <small>
      48
     </small>
    </sup>
   </center>
   <p>
    <!-- The next value <var>r</var><sub><small>2</small></sub> is computed from <var>r</var><sub><small>1</small></sub> using the same computation, and so forth. This sequence is of 48-bit numbers; the value seen from the component is the low-order bits as configured by its Data Bits attribute, after first throwing out the lower 12 bits of the current seed. -->
    下一个值
    <var>
     r
    </var>
    <sub>
     <small>
      2
     </small>
    </sub>
    is computed from
    <var>
     r
    </var>
    <sub>
     <small>
      1
     </small>
    </sub>
    使用相同的计算，依此类推。 该序列是 48 位数字； 在首先丢弃当前种子的低 12 位之后，从组件看到的值是由其数据位属性配置的低位。
   </p>
   <p>
    <!-- Besides the clock input, the component also includes an <var>enable</var> input, which leads the clock input to be ignored when <var>enable</var> is 0, and the <var>reset</var> input, which resets the component's value asynchronously to the initial seed <var>r</var><sub><small>0</small></sub>. -->
    除了时钟输入外，该组件还包含一个
    <var>
     enable
    </var>
    输入，这会导致当
    <var>
     enable
    </var>
    为0时忽略时钟输入，并且
    <var>
     reset
    </var>
    输入，它将组件的值异步重置为初始种子
    <var>
     r
    </var>
    <sub>
     <small>
      0
     </small>
    </sub>
    。
   </p>
   <p>
    <!-- The initial seed is user-configurable. If it is configured at 0 (which is the default), then the seed is based on the current time; when instructed to reset through the <var>reset</var> input, the component computes a new seed based on the new current time. -->
    初始种子是用户可配置的。 如果配置为0（默认），则种子基于当前时间； 当通过
    <var>
     reset
    </var>
    输入指示重置时，组件会根据新的当前时间计算新的种子。
   </p>
   <h2>
    <!-- Pins -->
    引脚
   </h2>
   <dl>
    <dt>
     <!-- East edge, labeled <var>Q</var> (output, bit width matches Data Bits attribute) -->
     东边，标记为
     <var>
      Q
     </var>
     （输出，位宽与数据位属性匹配）
    </dt>
    <dd>
     <!-- Outputs the value currently stored by the component. -->
     输出组件当前存储的值。
    </dd>
    <dt>
     <!-- West edge, top pin, labeled with a triangle (input, bit width 1) -->
     西边，顶部引脚，标有三角形（输入，位宽 1）
    </dt>
    <dd>
     <!-- Clock: At the instant that this is triggered as specified by the Trigger attribute, the component steps to the following number in its sequence. -->
     时钟：在按“触发器”属性指定的方式触发此事件时，组件将按其顺序步进到下一个数字。
    </dd>
    <dt>
     <!-- West edge, bottom pin (input, bit width 1) -->
     西边，底部引脚（输入，位宽1）
    </dt>
    <dd>
     <!-- Enable: The component is enabled when this input is disconnected or 1; but if it is 0, then the clock input is ignored. -->
     使能：当该输入断开或为1时，该组件使能； 但如果为 0，则忽略时钟输入。
    </dd>
    <dt>
     <!-- South edge (input, bit width 1) -->
     南边缘（输入，位宽1）
    </dt>
    <dd>
     <!-- Reset: When this is 1, the pseudorandom sequence asynchronously resets to the initial seed. (If seed is 0, this new seed should be different from the initial seed used previously.) -->
     Reset：当该值为 1 时，伪随机序列异步重置为初始种子。 （如果种子为 0，则这个新种子应该与之前使用的初始种子不同。）
    </dd>
   </dl>
   <h2>
    <!-- Attributes -->
    属性
   </h2>
   <p>
    <!-- When the component is selected or being added, Alt-0 through Alt-9 alter its <q>Data Bits</q> attribute. -->
    当选择或添加组件时，Alt-0 到 Alt-9 会更改其
    <q>
     数据位
    </q>
    属性。
   </p>
   <dl>
    <dt>
     <!-- Data Bits -->
     数据位
    </dt>
    <dd>
     <!-- The bit width of the value emitted by the component. -->
     组件发出的值的位宽度。
    </dd>
    <dt>
     <!-- Seed -->
     种子
    </dt>
    <dd>
     <!-- The starting value used for the pseudorandom sequence. If this is 0 (the default), then the starting value is based on the time that the random sequence began. -->
     用于伪随机序列的起始值。 如果此值为 0（默认值），则起始值基于随机序列开始的时间。
    </dd>
    <dt>
     <!-- Trigger -->
     扳机
    </dt>
    <dd>
     <!-- Configures how the clock input is interpreted. The value <q>rising edge</q> indicates that the component should update its value at the instant when the clock rises from 0 to 1. The <q>falling edge</q> value indicates that it should update at the instant the clock falls from 1 to 0. -->
     配置如何解释时钟输入。
     <q>
      上升沿
     </q>
     值表示该组件应在时钟从0上升到1的瞬间更新其值。
     <q>
      下降沿
     </q>
     值表示应在时钟从0上升到1的瞬间更新其值 时钟从 1 落到 0。
    </dd>
    <dt>
     <!-- Label -->
     标签
    </dt>
    <dd>
     <!-- The text within the label associated with the component. -->
     与组件关联的标签内的文本。
    </dd>
    <dt>
     <!-- Label Font -->
     标签字体
    </dt>
    <dd>
     <!-- The font with which to render the label. -->
     用于呈现标签的字体。
    </dd>
   </dl>
   <h2>
    <!-- Poke Tool Behavior -->
    Poke 工具行为
   </h2>
   <p>
    <!-- None. -->
    无
   </p>
   <h2>
    <!-- Text Tool Behavior -->
    文本工具行为
   </h2>
   <p>
    <!-- Allows the label associated with the component to be edited. -->
    允许编辑与组件关联的标签。
   </p>
   <p>
    <!-- <a href="../index.html">Back to <em>Library Reference</em></a> -->
    <b>
     返回
    </b>
    <a href="../index.html">
     电路元件库参考手册
    </a>
   </p>
  </div>
 </body>
</html>
